package com.fan.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fan.dao.VideoDao;
import com.fan.entity.Video;
import com.fan.service.VideoService;
import com.fan.utils.CommonResults;
import com.sixth.until.CommonResult;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: self-tui-education
 * @description:
 * @author: 老范
 * @create: 2022-05-09 17:55
 **/
@Service
public class VideoServiceImpl extends ServiceImpl<VideoDao, Video> implements VideoService {
    @Autowired
    private VideoDao videoDao;
    //    根据课程id查询所有的章节视频
    @Override
    public CommonResults queryAllVideoByCourseId(String id) {
        QueryWrapper<Video> videoWrapper = new QueryWrapper<>();
        videoWrapper.eq("course_id",id);
        videoWrapper.eq("is_free",true);
        List<Video> videos = videoDao.selectList(videoWrapper);
        return new CommonResults(2000,"查询成功",videos);
    }
}
